<?php
/**
 * Created by PhpStorm.
 * User: tangyunfei
 * Date: 2018/4/18
 * Time: 9:34
 */
class ToosModel extends  Model{
    /* 上传图片
* Enter description here ...
*/
    function upfile(){

        import('ORG.Net.UploadFile');
        $path=date("Ym").'/';
        $upload = new UploadFile();// 实例化上传类
        $upload->maxSize  = 3145728 ;// 设置附件上传大小
        $upload->allowExts  = array('jpg', 'gif', 'png', 'jpeg');// 设置附件上传类型
        $upload->savePath =  './Data/photo/'.$path;// 设置附件上传目录
        if(!file_exists("./Data/photo/".$path)){
            mkdir("./Data/photo/".$path);
        }
        if(!$upload->upload()) {
            // 上传错误提示错误信息

            return $upload->getErrorMsg();
        }else{

            $info = $upload->getUploadFileInfo(); //获取上传结果信息
            $photopath= str_replace(".","",$info[0]['savepath']);
            $s=$photopath.$info[0]['savename'];

            return $s;



        }
    }

}